home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Developer Connection Student Program
/
ADC Tools Sampler CD Disk 3 1999.iso
/
Apple Development Tools
/
MacsBug 6.5.4a6.sit
/
MacsBug 6.5.4a6
/
Building dcmds
/
Pascal Samples
/
Where.p
< prev
next >
Wrap
Text File
|
1998-09-22
|
3KB
|
98 lines
{
File: Where.p
Contains: Pascal source for the Where dcmd
Written by: JM3 = Jim Murphy
Copyright: © 1991, 1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<2> 14-Dec-94 JM3 Updated for format 3 dcmd requirements.
}
UNIT Where;
(* The following MPW commands will build the dcmd and copy it to the
"Debugger Prefs" file in the System folder. The dcmd's name in
MacsBug will be the name of the file built by the Linker.
Pascal Where.p
Link dcmdGlue.a.o Where.p.o {Libraries}Runtime.o -o Where
BuildDcmd Where 102
Echo 'include "Where";' | Rez -a -o "{systemFolder}Debugger Prefs"
*)
{$R-}
INTERFACE
USES MemTypes, dcmd;
{ Public declaration for dcmdGlue. Must be in every dcmd. The name cannot be changed. }
PROCEDURE CommandEntry (paramPtr: dcmdBlockPtr);
IMPLEMENTATION
CONST CR = $0D;
PROCEDURE CommandEntry (paramPtr: DCmdBlockPtr);
VAR address: LONGINT;
ch: CHAR;
ok: BOOLEAN;
name: Str255;
BEGIN
IF paramPtr^.request = dcmdInit THEN
BEGIN { The dcmd gets called once when loaded to init itself }
END
ELSE
IF paramPtr^.request = dcmdDoIt THEN
BEGIN { Do the command's normal function }
IF dcmdPeekAtNextChar = CHR(CR) THEN
address := paramPtr^.registerFile^[PCRegister]
ELSE
BEGIN
ch := dcmdGetNextExpression (address, ok);
IF NOT ok THEN
BEGIN
dcmdDrawLine ('Syntax error');
Exit (CommandEntry);
END;
END;
IF (address >= $0000A000) AND (address <= $0000ABFF) THEN
BEGIN
dcmdGetTrapName (address, name);
dcmdDrawLine (name);
END
ELSE
BEGIN
dcmdGetNameAndOffset (address, name);
IF Length (name) > 0
THEN dcmdDrawLine (name)
ELSE dcmdDrawLine ('No procedure name found');
END;
END
ELSE
IF paramPtr^.request = dcmdHelp THEN
BEGIN { Display the command's help information }
dcmdDrawLine ('Display information about the address or trap');
dcmdDrawLine ('If no parameter then use PC as the address');
END ELSE IF paramPtr^.request = dcmdGetInfo THEN BEGIN
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.usageStr := '[addr | trap]';
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.creditsStr := '';
{ Set the version to 3.0 final. }
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.majorRev := $03;
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.minorAndBugRev := $00;
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.stage := $80;
GetInfoRequestBlockPtr(paramPtr^.requestIOBlock)^.dcmdVersion.nonRelRev := $00;
END;
END;
END.